package com.shujia.five;

public class OperatorTest4 {

    public static void main(String[] args) {
        int x = 1;
        int y = 1;

        // 1 == 2 -> false
        // if 就是false,
        // 不是短路的&, 后面也会计算, y自增,2
        if (x++ == 2 & ++y == 2) {
            x = 7;
        }
        System.out.println("x=" + x + ",y=" + y);

        System.out.println("-------------------");

        x = 1;
        y = 1;

        //
        if (x++ == 2 && ++y == 2) {
            x = 7;
        }
        System.out.println("x=" + x + ",y=" + y);

        System.out.println("-------------------");

        x = 1;
        y = 1;
        // true | false -> true
        if (x++ == 1 | ++y == 1) {
            x = 7;
        }
        System.out.println("x=" + x + ",y=" + y);

        System.out.println("-------------------");

        x = 1;
        y = 1;
        // true
        if (x++ == 1 || ++y == 1) {
            x = 7;
        }
        System.out.println("x=" + x + ",y=" + y);


    }
}
